package com.mall.db.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 评论管理表
 * </p>
 *
 * @author HQJ
 * @since 2021-09-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_comments")
public class Comments implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 打分
     */
    private Double score;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 评论图片
     */
    private String photo;

    /**
     * 评论时间
     */
    @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss a", locale="zh", timezone="GMT+8")
    private Date createTime;

    public Date getCreateTime() {
        if(StringUtils.isEmpty(createTime)){
            return new Date();
        }
        return createTime;
    }


    private Integer goodId;

    private String goodIds;


    private String userId;

    private Integer uid;

}
